Cannot mask with non-boolean array containing NA - NaN values

62

# if there are null values (e.g. NaN) values in the column, then the following
# error will show:
# "Cannot mask with non-boolean array containing NA / NaN values"
# setting na=False for the contains() method solves the problem
df['column_name'].str.contains(string_to_be_matched_with, na=False)
mask = dframe.Product.str.contains(word, case=False, na=False)

Comments

Submit
0 Comments